package threads;

public class RunnableExample {

	public static void main(String[] args) {
		Runnable r = new Runnable() {
			public void run() {
				for (int i=1; i<=5; i++) {
					System.out.println(Thread.currentThread().getName());
					try {
						Thread.sleep((long) (Math.random() * 1000));
					} catch (InterruptedException e) {
					}
				}
			}
		};

		Thread t1 = new Thread(r);
		t1.start();
		Thread t2 = new Thread(r);
		t2.start();
		Thread t3 = new Thread(r);
		t3.start();
	}

}
